package org.zasadnyy.redlions.players.server.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class PlayerObject implements Serializable {

	private static final long serialVersionUID = 7756873296917843643L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;

	//main information
	
	@Persistent
	private String name;

	@Persistent
	private String surname;

	@Persistent
	private String photoUrl;
	
	//general information

	@Persistent
	private String nativeCity;

	@Persistent
	private Date birtday;

	@Persistent
	private Date playsFrom;

	// Contact information
	@Persistent
	private String forumProfile;
	
	@Persistent
	private String email;
	
	@Persistent
	private String phoneNumber;
	
	//anthropometric parameters
	@Persistent
	private String tall;
	
	@Persistent
	private String weight;
	
	@Persistent
	private String tShirtSize;
	
	@Persistent
	private Set<Key> tournaments = new HashSet<Key>();

	public PlayerObject() {
	}

	public PlayerObject(String name, String surname, String photoUrl,
			String nativeCity, Date birtday, Date playsFrom) {
		super();
		this.name = name;
		this.surname = surname;
		this.photoUrl = photoUrl;
		this.nativeCity = nativeCity;
		this.birtday = birtday;
		this.playsFrom = playsFrom;
	}

	public PlayerObject(String name, String surname, String photoUrl,
			String nativeCity, Date birtday, Date playsFrom,
			Set<Key> tournaments) {
		super();
		this.name = name;
		this.surname = surname;
		this.photoUrl = photoUrl;
		this.nativeCity = nativeCity;
		this.birtday = birtday;
		this.playsFrom = playsFrom;
		this.tournaments = tournaments;
	}

	public PlayerObject(Key id, String name, String surname, String photoUrl,
			String nativeCity, Date birtday, Date playsFrom,
			Set<Key> tournaments) {
		super();
		this.id = id;
		this.name = name;
		this.surname = surname;
		this.photoUrl = photoUrl;
		this.nativeCity = nativeCity;
		this.birtday = birtday;
		this.playsFrom = playsFrom;
		this.tournaments = tournaments;
	}

	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getSurname() {
		return surname;
	}

	public void setPhotoUrl(String photoUrl) {
		this.photoUrl = photoUrl;
	}

	public String getPhotoUrl() {
		return photoUrl;
	}

	public String getNativeCity() {
		return nativeCity;
	}

	public void setNativeCity(String nativeCity) {
		this.nativeCity = nativeCity;
	}

	public Date getBirtday() {
		return birtday;
	}

	public void setBirtday(Date birtday) {
		this.birtday = birtday;
	}

	public Date getPlaysFrom() {
		return playsFrom;
	}

	public void setPlaysFrom(Date playsFrom) {
		this.playsFrom = playsFrom;
	}

	public Set<Key> getTournaments() {
		return tournaments;
	}

	public void setTournaments(Set<Key> tournaments) {
		this.tournaments = tournaments;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Player [id=").append(id).append(", nativeCity=")
				.append(nativeCity).append(", birtday=").append(birtday)
				.append(", playsFrom=").append(playsFrom)
				.append(", tournaments=").append(tournaments).append("]");
		return builder.toString();
	}

}
